dengsixing 4 mēneši atpakaļ
vecāks
revīzija
5a37ce918b

+ 11 - 8
src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java

@@ -56,17 +56,21 @@ public class BuildSceneProcessLogListener{
             int status = CommonOperStatus.SUCCESS.code();
             int buildStatus = buildSceneMessage.getBuildStatus();
 
-            Map<String, Object> param = new HashMap<>();
-
-            param.put("scene_num", num);
-            param.put("event_time", new Date());
-            param.put("ryid", scenePlusService.getRyIdByNum(num));
-
-
             //新的计算开始,需要将之前的记录置为失效
             if(buildStatus == ModelingBuildStatus.CALCULATING.code()){
                 sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall);
                 status = CommonOperStatus.WAITING.code();
+                Map<String, Object> param = new HashMap<>();
+                try {
+                    param.put("event_type", "计算中");
+                    param.put("event_content", "计算中");
+                    param.put("scene_num", num);
+                    param.put("event_time", new Date());
+                    param.put("ryid", scenePlusService.getRyIdByNum(num));
+                    jmgaService.sendStatus(param);
+                }catch (Exception e){
+                    log.info("推送事件失败,param:{}", param);
+                }
             }else{
                 if(buildStatus != ModelingBuildStatus.SUCCESS.code()){
                     status = CommonOperStatus.FAILD.code();
@@ -74,7 +78,6 @@ public class BuildSceneProcessLogListener{
                 }
             }
 
-            jmgaService.sendStatus(param);
             sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(), queueModelingCall, status, reason);
         }catch (Exception e){
             log.error("场景计算流程状态日志记录出错, num="+num, e);

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

@@ -253,7 +253,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 param.put("ryid", scenePlusService.getRyIdByNum(num));
                 jmgaService.sendStatus(param);
             }catch (Exception e){
-                log.info("推送时间失败,param:{}", param);
+                log.info("推送事件失败,param:{}", param);
             }
 
             mqProducer.sendByWorkQueue(queueModelingCall, message);
@@ -264,6 +264,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             log.error("场景计算前置处理出错,num"+num, e);
 //            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
             this.sendFailToLaser(num);
+
+            Map<String, Object> param = new HashMap<>();
+            try {
+                param.put("event_type", "排队中");
+                param.put("event_content", "计算资源准备失败");
+                param.put("scene_num", num);
+                param.put("event_time", new Date());
+                param.put("ryid", scenePlusService.getRyIdByNum(num));
+                jmgaService.sendStatus(param);
+            }catch (Exception e){
+                log.info("推送事件失败,param:{}", param);
+            }
+
             throw e;
         }
     }
@@ -393,6 +406,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 this.sendFailToLaser(sceneCode);
 
                 redisUtil.set(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, sceneCode), "-1");
+
+                Map<String, Object> param = new HashMap<>();
+                try {
+                    param.put("event_type", "计算失败");
+                    param.put("event_content", "算法报错");
+                    param.put("scene_num", sceneCode);
+                    param.put("event_time", new Date());
+                    param.put("ryid", scenePlusService.getRyIdByNum(sceneCode));
+                    jmgaService.sendStatus(param);
+                }catch (Exception e){
+                    log.info("推送事件失败,param:{}", param);
+                }
+
                 return;
             }
 
@@ -553,10 +579,35 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
 
+            Map<String, Object> param = new HashMap<>();
+            try {
+                param.put("event_type", "计算成功");
+                param.put("event_content", "计算成功");
+                param.put("scene_num", sceneCode);
+                param.put("event_time", new Date());
+                param.put("ryid", scenePlusService.getRyIdByNum(sceneCode));
+                jmgaService.sendStatus(param);
+            }catch (Exception e){
+                log.info("推送事件失败,param:{}", param);
+            }
+
         }catch (Exception e){
             log.error("场景计算结果处理出错,num"+sceneCode, e);
 //            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             this.sendFailToLaser(sceneCode);
+
+            Map<String, Object> param = new HashMap<>();
+            try {
+                param.put("event_type", "计算失败");
+                param.put("event_content", "计算结果处理失败");
+                param.put("scene_num", sceneCode);
+                param.put("event_time", new Date());
+                param.put("ryid", scenePlusService.getRyIdByNum(sceneCode));
+                jmgaService.sendStatus(param);
+            }catch (Exception ex){
+                log.info("推送事件失败,param:{}", param);
+            }
+
             throw e;
         } finally {
             Map<String, Object> sceneStatusParam = new HashMap<>();

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

@@ -1689,7 +1689,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             param.put("ryid", scenePlusService.getRyIdByNum(sceneNum));
             jmgaService.sendStatus(param);
         }catch (Exception e){
-            log.info("推送时间失败,param:{}", param);
+            log.info("推送事件失败,param:{}", param);
         }
 
         rabbitMqProducer.sendByWorkQueue(queueModelingPre, mqMessage);