dengsixing hai 3 meses
pai
achega
73c659629d

+ 17 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -146,12 +146,15 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     private ILinkPanService linkPanService;
     @Autowired
     private IJmgaService jmgaService;
+    @Autowired
+    private MjService mjService;
 
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
         boolean success = false;
         String num = message.getSceneNum();
+        String filename = (String)message.getExt().get("filename");
         try {
             //重新计算时需要删除文件夹,否知使用缓存
             if(new File(message.getPath() + File.separator + "results").exists()){
@@ -232,6 +235,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }catch (Exception e){
             log.error("场景计算前置处理出错,num"+num, e);
             this.sendFailToLaser(num);
+            if(StrUtil.isNotEmpty(filename)){
+                mjService.distributeDetailDone("2", filename);
+            }
             throw e;
         }
     }
@@ -332,6 +338,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Override
     public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
         String sceneCode = message.getBuildContext().get("sceneNum").toString();
+        String filename = (String)message.getExt().get("filename");
         String path = message.getPath();
         try {
             // 上传计算日志
@@ -352,6 +359,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
                 this.sendFailToLaser(sceneCode);
                 redisUtil.set(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, sceneCode), "-1");
+                if(StrUtil.isNotEmpty(filename)){
+                    mjService.distributeDetailDone("2", filename);
+                }
                 return;
             }
 
@@ -514,12 +524,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             redisUtil.set(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, sceneCode), "1");
 
+            if(StrUtil.isNotEmpty(filename)){
+                mjService.distributeDetailDone("1", filename);
+            }
+
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
 
         }catch (Exception e){
             log.error("场景计算结果处理出错,num"+sceneCode, e);
 //            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             this.sendFailToLaser(sceneCode);
+            if(StrUtil.isNotEmpty(filename)){
+                mjService.distributeDetailDone("2", filename);
+            }
             throw e;
         }
     }

+ 2 - 0
src/main/java/com/fdkankan/contro/service/MjService.java

@@ -4,4 +4,6 @@ public interface MjService {
 
     void bd();
 
+    void distributeDetailDone(String status, String filename);
+
 }

+ 21 - 25
src/main/java/com/fdkankan/contro/service/impl/MjServiceImpl.java

@@ -15,20 +15,18 @@ import com.fdkankan.contro.entity.SceneFileBuild;
 import com.fdkankan.contro.entity.SceneFilename;
 import com.fdkankan.contro.entity.SceneOrigBd;
 import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.httpclient.MjHttpClient;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.fyun.config.FYunFileConfig;
 import com.fdkankan.fyun.local.constant.LocalConstants;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.utils.SceneUtil;
-import com.fdkankan.web.util.RSAEncrypt;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.binary.Base64;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.File;
-import java.nio.charset.StandardCharsets;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -47,6 +45,8 @@ public class MjServiceImpl implements MjService {
     private IScenePlusService scenePlusService;
     @Autowired
     private ISceneFilenameService sceneFilenameService;
+    @Resource
+    private MjHttpClient mjHttpClient;
 
 
     @Override
@@ -54,7 +54,7 @@ public class MjServiceImpl implements MjService {
 
         List<SceneOrigBd> list = sceneOrigBdService.list(new LambdaQueryWrapper<SceneOrigBd>().eq(SceneOrigBd::getStatus, CommonSuccessStatus.WAITING.code()));
 
-        if(CollUtil.isEmpty(list)){
+        if (CollUtil.isEmpty(list)) {
             return;
         }
         for (SceneOrigBd v : list) {
@@ -66,15 +66,15 @@ public class MjServiceImpl implements MjService {
 
                 ScenePlus scenePlus = null;
                 List<SceneFilename> SceneFilenames = sceneFilenameService.list(new LambdaQueryWrapper<SceneFilename>().eq(SceneFilename::getUnicode, unicode));
-                if(CollUtil.isNotEmpty(SceneFilenames)){
+                if (CollUtil.isNotEmpty(SceneFilenames)) {
                     String num = SceneFilenames.get(0).getNum();
-                    if(StrUtil.isNotEmpty(num)){
+                    if (StrUtil.isNotEmpty(num)) {
                         scenePlus = scenePlusService.getScenePlusByNum(num);
                     }
                 }
 
                 //如果场景正在计算,跳过,等待下一次定时任务进入时在进行处理
-                if(Objects.nonNull(scenePlus) && scenePlus.getSceneStatus() == SceneStatus.wait.code()){
+                if (Objects.nonNull(scenePlus) && scenePlus.getSceneStatus() == SceneStatus.wait.code()) {
                     continue;
                 }
 
@@ -93,8 +93,8 @@ public class MjServiceImpl implements MjService {
 
                 SceneFileBuild sceneFileBuild = sceneFileBuildService.getOne(new LambdaQueryWrapper<SceneFileBuild>().eq(SceneFileBuild::getUnicode, unicode));
                 String fileId = null;
-                if(Objects.isNull(sceneFileBuild)){
-                    fileId = String.valueOf(new SnowflakeIdGenerator(0,0).nextId());
+                if (Objects.isNull(sceneFileBuild)) {
+                    fileId = String.valueOf(new SnowflakeIdGenerator(0, 0).nextId());
                     sceneFileBuild = new SceneFileBuild();
                     sceneFileBuild.setFileId(fileId);
                     sceneFileBuild.setUnicode(unicode);
@@ -102,17 +102,17 @@ public class MjServiceImpl implements MjService {
                     sceneFileBuild.setCreateTime(new Date());
                     sceneFileBuild.setRecStatus(RecStatus.VALID.code());
                     sceneFileBuildService.save(sceneFileBuild);
-                }else{
+                } else {
                     fileId = sceneFileBuild.getFileId();
                 }
-                String realDataSource =  ConstantFilePath.BUILD_MODEL_PATH + snCode + "/" + fileId + "/" + unicode;
+                String realDataSource = ConstantFilePath.BUILD_MODEL_PATH + snCode + "/" + fileId + "/" + unicode;
                 String realOssHomePath = SceneUtil.getHomePath(realDataSource);
                 String realOssHomeAbsolutePath = LocalConstants.BASE_PATH + fYunFileConfig.getBucket() + "/" + realOssHomePath;
                 FileUtil.loopFiles(zipDir).stream().forEach(file -> {
-                    FileUtil.copy(file.getAbsolutePath(),  file.getAbsolutePath().replace(zipDir, realOssHomeAbsolutePath), true);
+                    FileUtil.copy(file.getAbsolutePath(), file.getAbsolutePath().replace(zipDir, realOssHomeAbsolutePath), true);
                 });
 
-                sceneFileBuildService.noticeBuild(unicode, filename);
+                sceneFileBuildService.noticeBuild(unicode, filename, realDataSource);
                 v.setStatus(CommonSuccessStatus.SUCCESS.code());
             } catch (Exception e) {
                 v.setStatus(CommonSuccessStatus.FAIL.code());
@@ -121,17 +121,13 @@ public class MjServiceImpl implements MjService {
         }
     }
 
-    public static void main(String[] args) throws Exception {
-        String paramsStr = "90d95cdb5#1111#333#90d95cdb5_20250115175933#123";
-        byte[] res = RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile()),
-                paramsStr.getBytes(StandardCharsets.UTF_8));
-        System.out.println(new Base64().encodeToString(res));
-
-        byte[] res2 = RSAEncrypt.decrypt(RSAEncrypt.loadPrivateKeyByStr(RSAEncrypt.loadPrivateKeyByFile()),
-                new Base64().decode(new Base64().encodeToString(res)));
-        String restr = new String(res2, "UTF-8");
-        System.out.println(restr);
-
-
+    @Override
+    public void distributeDetailDone(String status, String filename) {
+        JSONObject param = new JSONObject();
+        param.put("data", status);
+        param.put("filename", filename);
+        mjHttpClient.done(param);
     }
+
 }
+

+ 12 - 2
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -250,6 +250,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
     @Autowired
     private ISceneOrigBdService sceneOrigBdService;
+    @Autowired
+    private ISceneFilenameService sceneFilenameService;
 
 
     @Override
@@ -1608,7 +1610,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     }
 
     private ScenePlusVO buildScenePost(String dataSource, JSONObject jsonObject, String buildType, long cameraType,
-                                       String sceneNum, Camera camera, CameraDetail cameraDetail, int rebuild,String icon,User user) throws Exception {
+                                       String sceneNum, Camera camera, CameraDetail cameraDetail, int rebuild,String icon,User user, String fileName) throws Exception {
         String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
 
         JSONObject firmwareVersion = new JSONObject();
@@ -1653,9 +1655,17 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 mqMessage.setFlexibility(-1);
             }
         }
+
         mqMessage.getExt().put("deleteExtras", true);
         mqMessage.getExt().put("gps", jsonObject.getString("gps"));
         mqMessage.getExt().put("threeCamType", scenePlusVO.getThreeCamType());
+        mqMessage.getExt().put("filename", fileName);
+
+        SceneFilename sceneFilename = new SceneFilename();
+        sceneFilename.setNum(sceneNum);;
+        sceneFilename.setFilename(fileName);
+        sceneFilename.setUnicode(unicode);
+        sceneFilenameService.save(sceneFilename);
 
         rabbitMqProducer.sendByWorkQueue(queueModelingPre, mqMessage);
 
@@ -2408,7 +2418,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 sceneNum = scene3dNumService.generateSceneNum(cameraDetail.getType());
             }
 
-            buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, camera, cameraDetail, rebuild, "", user);
+            buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, camera, cameraDetail, rebuild, "", user, fileName);
 
             scenePlus = scenePlusService.getScenePlusByNum(sceneNum);