dengsixing преди 1 година
родител
ревизия
6194d907ea

+ 36 - 28
src/main/java/com/fdkankan/contro/mq/listener/BuildE57Listener.java

@@ -2,6 +2,7 @@ package com.fdkankan.contro.mq.listener;
 
 import cn.hutool.core.exceptions.ExceptionUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.CommonOperStatus;
 import com.fdkankan.contro.constant.RedisConstants;
 import com.fdkankan.contro.mq.service.impl.BuildE57SceneServiceImpl;
@@ -9,6 +10,7 @@ import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.ISceneBuildProcessLogService;
 import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
 import com.fdkankan.redis.util.RedisLockUtil;
 import com.rabbitmq.client.Channel;
 import lombok.extern.slf4j.Slf4j;
@@ -27,9 +29,12 @@ import java.util.HashMap;
 @Component
 public class BuildE57Listener{
 
-    @Value("${queue.modeling.e57.modeling-pre}")
+    @Value("${queue.modeling.e57.modeling-pre:e57-modeling-pre}")
     private String queueModelingPre;
 
+    @Value("${queue.modeling.e57.modeling-pre:e57-modeling-post}")
+    private String queueModelingPost;
+
     @Autowired
     private RedisLockUtil redisLockUtil;
 
@@ -48,22 +53,11 @@ public class BuildE57Listener{
      * @throws Exception
      */
     @RabbitListener(
-            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-pre}"),
+            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-pre:e57-modeling-pre}"),
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
-        if(!ObjectUtils.isEmpty(messageId)){
-            // 设置消息id幂等性,防止消息重复消费
-            boolean lock = redisLockUtil.lock(RedisConstants.SCENE_PREPARE_BUILDING + messageId, 24 * 3600);
-            if (!lock) {
-                log.error("服务:{},消息重复消费:{}", "常驻服务", messageId);
-                channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
-                return;
-            }
-        }
-
         String msg = new String(message.getBody(), StandardCharsets.UTF_8);
         HashMap<String, Object> map = JSON.parseObject(msg, HashMap.class);
         String num = (String) map.get("num");
@@ -74,7 +68,6 @@ public class BuildE57Listener{
         buildSceneMessage.setSceneNum(num);
         buildSceneMessage.setExt(map);
         buildSceneMessage.setBuildType("V3");
-        String num = buildSceneMessage.getSceneNum();
         try {
             if(ObjectUtils.isEmpty(buildSceneMessage.getBuildContext())){
                 buildSceneMessage.setBuildContext(new HashMap<>());
@@ -95,18 +88,33 @@ public class BuildE57Listener{
         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
     }
 
-//    /**
-//     * 场景计算后置结果处理
-//     * @param channel
-//     * @param message
-//     * @throws Exception
-//     */
-//    @RabbitListener(
-//            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-post}"),
-//            concurrency = "${maxThread.modeling.modeling-post}"
-//    )
-//    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-//        postHandle(channel,queueModelingPost,message,buildSceneService);
-//
-//    }
+    /**
+     * 场景计算后置结果处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-post:e57-modeling-post}"),
+            concurrency = "${maxThread.modeling.modeling-post}"
+    )
+    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("场景计算完成,开始处理e57计算结果,队列名:{},id:{},消息体:{}", queueModelingPost, messageId, msg);
+        BuildSceneResultMqMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneResultMqMessage.class);
+        String num = buildSceneMessage.getBuildContext().get("sceneNum").toString();
+        try {
+//            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.WAITING.code(), null);
+            buildSceneService.buildScenePost(buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.SUCCESS.code(), null);
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
+        }
+        log.info("场景计算结果处理完成,队列名:{},id:{},消息体:{}", queueModelingPost, messageId, msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+
+    }
 }

+ 29 - 288
src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java

@@ -1,13 +1,7 @@
 package com.fdkankan.contro.mq.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.io.FileUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.constant.*;
-import com.fdkankan.common.util.FileUtils;
+import cn.hutool.core.util.ZipUtil;
+import com.fdkankan.common.constant.CommonSuccessStatus;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePlusExt;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
@@ -16,14 +10,10 @@ import com.fdkankan.fyun.config.FYunFileConfig;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
-import com.fdkankan.model.enums.ModelTypeEnums;
-import com.fdkankan.model.utils.CreateObjUtil;
-import com.fdkankan.model.utils.SceneUtil;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
 import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
@@ -31,8 +21,9 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.File;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -47,6 +38,7 @@ import java.util.*;
 @Service
 @RefreshScope
 public class BuildE57SceneServiceImpl implements IBuildSceneService {
+    public static final String logUrlFormat = "**algorithm-log**: [%sbuild_log/%s/e57/console.log](%sbuild_log/%s/e57/console.log)";
 
     @Value("${queue.modeling.e57.modeling-post}")
     private String queueModelingPost;
@@ -56,6 +48,8 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
     private String env;
     @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
     private List<String> notDeleteNasNumList;
+    @Value("${queue.modeling.e57.modeling-done:e57-modeling-done}")
+    private String queueE57ModelingDone;
     @Autowired
     private RabbitMqProducer mqProducer;
     @Resource
@@ -120,298 +114,45 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
 
     @Override
     public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
-        String sceneCode = message.getBuildContext().get("sceneNum").toString();
+        String num = message.getBuildContext().get("sceneNum").toString();
         String path = message.getPath();
+        String bucket = (String)message.getExt().get("bucket");
+        String ossKeyFormat = (String)message.getExt().get("ossKey");
         try {
             // 上传计算日志
             //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
             log.info("开始上传计算日志");
-            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, num) + "e57/";
             fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
             log.info("计算日志上传完成");
+            Map<String, Object> laserMqContent = new HashMap<>();
+            laserMqContent.put("num", num);
 
             if (!message.getBuildSuccess()) {
-                log.error("建模失败,修改状态为失败状态");
-                scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
-                        .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
-                        .eq(ScenePlus::getNum, sceneCode));
+
+                //发送mq通知激光系统
+                laserMqContent.put("status", CommonSuccessStatus.FAIL.code());
+                mqProducer.sendByWorkQueue(queueE57ModelingDone, laserMqContent);
 
                 // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
+                String logUrl = String.format(logUrlFormat,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), num, message.getHostName(), logUrl);
                 return;
             }
-            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
-
-            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
-
-            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
-            Map<String, String> uploadFiles = getUploadFiles(scenePlus,path);
-
-            scenePlus.setPayStatus(PayStatus.PAY.code());
-            scenePlus.setUpdateTime(new Date());
-            scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
-
-            Integer videoVersion = fdageData.getInteger("videoVersion");
-            //读取计算结果文件生成videosJson
-            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
-
-            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
-
-            log.info("开始上传场景计算结果数据,num:{}", sceneCode);
-            //上传文件
-            fYunFileService.uploadMulFiles(uploadFiles);
-
-            //容量统计
-            Long space = commonService.getSpace(sceneCode);
-
-            //写入数据库
-            this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),false,scenePlusExt);
 
-            Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
-
-            //统计原始资源大小
-            scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
-
-            //删除计算目录
-            if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
-                CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
-            }
-
-            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
-            scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
-
-            this.uploadStatusJson(scenePlus, scenePlusExt);
-
-            scenePlusService.updateById(scenePlus);
-            scenePlusExtService.updateById(scenePlusExt);
-
-            //推送到全景看看
-            intermitSceneService.sendMq(sceneCode, fdageData, CommonSuccessStatus.SUCCESS.code());
-
-            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
+            //压缩e57
+            String localPath = path + "/results/laserData/laser.e57";
+            String zipPath = path + "/results/laserData/laser-e57.zip";
+            String ossKey = String.format(ossKeyFormat, num, num);
+            ZipUtil.zip(localPath, zipPath);
+            fYunFileService.uploadFile(bucket, zipPath, ossKey);
+            log.info("e57场景计算结果处理结束,场景码:{}", num);
 
         }catch (Exception e){
-            log.error("场景计算结果处理出错,num"+sceneCode, e);
-            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
+            log.error("e57场景计算结果处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("e57场景计算结果处理出错!", message.getPath(), num, "计算控制服务器");
             throw e;
         }
     }
 
-    private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path) throws Exception {
-        String projectNum = scenePlus.getNum();
-        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
-        String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
-        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
-        String resultsPath = path + File.separator + "results" + File.separator;
-
-        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
-        JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
-
-        JSONObject fileJson = null;
-        String fileName = "";
-
-        Map<String, String> map = new HashMap();
-
-        for (int i = 0; i < array.size(); ++i) {
-            fileJson = array.getJSONObject(i);
-            fileName = fileJson.getString("file");
-            String filePath = resultsPath + fileName;
-
-            if (!(new File(filePath)).exists()) {
-                throw new Exception(filePath + "文件不存在");
-            }
-
-            if(fileJson.getIntValue("clazz") == 1 || fileJson.getIntValue("clazz") == 22){
-                map.put(filePath, imagesPath + fileName);
-            }
-        }
-        return map;
-    }
-
-    private JSONObject getFdageData(String dataFdagePath) {
-        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
-        String data = FileUtils.readFile(dataFdagePath);
-        //获取data.fdage的内容
-        JSONObject dataJson = new JSONObject();
-        if(data!=null){
-            dataJson = JSONObject.parseObject(data);
-        }
-        return dataJson;
-    }
-
-    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
-        String num = scenePlus.getNum();
-        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
-
-        Integer status = 1;
-        // 上传status JSON.
-        JSONObject statusJson = new JSONObject();
-        //临时将-2改成1,app还没完全更新
-        statusJson.put("status", status);
-        statusJson.put("webSite", scenePlusExt.getWebSite());
-        statusJson.put("sceneNum", num);
-        statusJson.put("thumb", scenePlusExt.getThumb());
-        statusJson.put("payStatus", scenePlus.getPayStatus());
-        statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
-        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
-
-        fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataViewPath + "status.json");
-    }
-
-    private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
-        //读取videos_hdr_param.json, 保存点位视频的value
-        Map<String, Object> videoMap = new HashMap<>();
-        String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
-        JSONArray videoArray = null;
-        if(StringUtils.isNotEmpty(videosHdr)){
-            videoArray = JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
-        }
-        if(videoArray != null){
-            for(int i = 0, len = videoArray.size(); i < len; i++) {
-                videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
-                if(videoArray.getJSONObject(i).containsKey("fov")){
-                    videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
-                }
-            }
-        }
-
-        //获取upload中的video视频名称
-        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
-        JSONObject uploadJson = null;
-        JSONArray array = null;
-        if(uploadData!=null) {
-            uploadJson = JSONObject.parseObject(uploadData);
-            array = uploadJson.getJSONArray("upload");
-        }
-        JSONObject fileJson = null;
-        String fileName = "";
-
-        //计算ts文件的大小,并拼接成json格式
-        JSONArray jsonArray = new JSONArray();
-        JSONObject videoJson = null;
-        JSONObject videosJson = new JSONObject();
-        long videoSize = 0L;
-        for(int i = 0, len = array.size(); i < len; i++) {
-            fileJson = array.getJSONObject(i);
-            fileName = fileJson.getString("file");
-            if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
-                videoJson = new JSONObject();
-                videoJson.put("id", fileName.substring(
-                    0, fileName.lastIndexOf(".")).replace("videos/", ""));
-
-                //如果ts文件存在,就计算ts大小
-                if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
-                    videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
-                    videoJson.put("tsSize", videoSize);
-                }
-                if(videoMap.containsKey(videoJson.get("id"))){
-                    videoJson.put("value", videoMap.get(videoJson.get("id")));
-                }
-                if(videoMap.containsKey(videoJson.get("id") + "_fov")){
-                    videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
-                }else {
-                    videoJson.put("blend_fov", 7);
-                }
-                jsonArray.add(videoJson);
-            }
-        }
-
-        videosJson.put("data", jsonArray);
-        if(Objects.nonNull(videoVersion) && videoVersion >= 4){
-            videosJson.put("version", 3);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
-            if(cameraType == 13){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }else {
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
-            if(cameraType == 13){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }
-
-        if(cameraType == 5 || cameraType == 6){
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
-        }
-
-        return videosJson;
-    }
-    private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
-
-        scenePlusExt.setSpace(space);
-        scenePlusExt.setComputeTime(computeTime.toString());
-        scenePlusExt.setAlgorithmTime(new Date());
-        scenePlusExt.setVideos(videosJson);
-        scenePlusExt.setIsObj(isObj ? 1 : 0);
-
-        if(ModelTypeEnums.TILE_CODE.equals(modelType)){
-            scenePlusExt.setSceneScheme(3);
-        }
-
-        switch (SceneSource.get(sceneSource)){
-            case BM:
-                scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
-                scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
-                break;
-            case SM:
-                scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
-                scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
-                break;
-            case ZT:
-                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
-                scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
-                break;
-            case JG:
-                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
-                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
-                break;
-            case SG:
-                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
-                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
-                break;
-        }
-
-        String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
-        scenePlusExt.setSceneKind(sceneKind);
-//        scenePlusExt.setModelKind(modelKind);
-
-        //统计点位数量
-        scenePlusExt.setShootCount(this.getShootCount(scenePlusExt));
-
-        scenePlusExtService.updateById(scenePlusExt);
-    }
-
-    private Integer getShootCount(ScenePlusExt scenePlusExt){
-        Integer shootCount = null;
-        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
-        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
-        if(Objects.nonNull(dataFdageObj)){
-            JSONArray points = dataFdageObj.getJSONArray("points");
-            if(CollUtil.isNotEmpty(points)){
-                shootCount = points.size();
-            }
-        }
-        if(Objects.nonNull(shootCount) && shootCount > 0){
-            return shootCount;
-        }
-
-        String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
-        JSONObject slamDataObj = JSON.parseObject(slamDataStr);
-        if(Objects.nonNull(slamDataObj)){
-            JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
-            if(CollUtil.isNotEmpty(viewsInfo)){
-                shootCount = viewsInfo.stream().mapToInt(info -> {
-                    return  ((JSONObject) info).getJSONArray("list_pose").size();
-                }).sum();
-            }
-        }
-
-        return shootCount;
-    }
-
-
 }

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

@@ -12,6 +12,8 @@ public interface IBuildSceneDTService {
 
     void handModelFail(String reason, String serverPath, String num, String hostName);
 
+    void handModelFail(String reason, String serverPath, String num, String hostName, String logUrl);
+
     void handBaseFail(String reason, String serverPath, String num, String hostName);
 
 }

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

@@ -46,30 +46,30 @@ public class BuildSceneDTServiceImpl implements IBuildSceneDTService {
 
     @Override
     public void handModelFail(String reason, String serverPath, String num, String hostName) {
-        CompletableFuture.runAsync(() -> {
-            try {
-                log.info("开始发送钉钉消息");
-                String logPath = String.format(contentExt,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
-                log.info("发送钉钉消息,content:{}", logPath);
-                String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath) + logPath;
-                log.info("发送钉钉消息,content:{}", content);
-                dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
-            } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
-                log.error("发送钉钉消息失败", apiException);
-            }
-        });
+        String logPath = String.format(contentExt,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
+        this.handModelFail(reason, serverPath, num, hostName, logPath);
+    }
+
+    @Override
+    public void handModelFail(String reason, String serverPath, String num, String hostName, String logPath) {
+        try {
+            log.info("发送钉钉消息,content:{}", logPath);
+            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath) + logPath;
+            log.info("发送钉钉消息,content:{}", content);
+            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
+        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
+            log.error("发送钉钉消息失败", apiException);
+        }
     }
 
     @Override
     public void handBaseFail(String reason, String serverPath, String num, String hostName) {
-        CompletableFuture.runAsync(() -> {
-            try {
-                String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath);
-                log.info("发送钉钉消息,content:{}", content);
-                dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
-            } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
-                log.error("发送钉钉消息失败", apiException);
-            }
-        });
+        try {
+            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath);
+            log.info("发送钉钉消息,content:{}", content);
+            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
+        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
+            log.error("发送钉钉消息失败", apiException);
+        }
     }
 }