From 4f85176c37666eeb24b1d417d423486769658b93 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 15 May 2024 17:01:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:open=5Fscada=E4=BF=AE=E6=94=B9=E4=B8=BAopen?= =?UTF-8?q?=5Fcanvas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/constants/FuncRouteEnum.java | 2 +- .../service/impl/ExtraResolveStrategyService.java | 24 ++++++++++++---------- .../service/impl/InteractiveServiceImpl.java | 3 +++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index aca3fab..c4fc85e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -26,7 +26,7 @@ public enum FuncRouteEnum { public static FuncRouteEnum getEnumByFuncCode(String funcCode) { Optional FuncRoute = Arrays.stream(FuncRouteEnum.class.getEnumConstants()).filter(e -> funcCode.equals(e.getFuncCode())).findFirst(); - return FuncRoute.get(); + return FuncRoute.orElse(null); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index 3e5f6c6..a9c590b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -50,17 +50,19 @@ public class ExtraResolveStrategyService { if(StringUtil.isNotBlank(functionCode)) { XxlJobLogger.log("函数编号为:" + functionCode); FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(functionCode); - switch (funcRouteEnum) { - case DIAGNOSE: - return this.resolveDiagnose(extra); - case CHOOSE_STATION: - return this.resolveChooseStation(extra); - case CHOOSE_VIDEO: - return this.resolveChooseVideo(extra); - case CHOOSE_CANVAS: - return this.resolveChooseScada(extra); - default: - break; + if(Func.isNotEmpty(funcRouteEnum)) { + switch (funcRouteEnum) { + case DIAGNOSE: + return this.resolveDiagnose(extra); + case CHOOSE_STATION: + return this.resolveChooseStation(extra); + case CHOOSE_VIDEO: + return this.resolveChooseVideo(extra); + case CHOOSE_CANVAS: + return this.resolveChooseScada(extra); + default: + break; + } } } return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index 1c09556..4e835a0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -73,6 +73,9 @@ public class InteractiveServiceImpl implements IInteractiveService { logger.info("interactive:resolve","开始解析大模型函数,函数内容为:" + JSON.toJSONString(req)); FunctionEntity function = functionService.getFunctionByCode(req.getFunctionName()); TypeEnum typeEnum = TypeEnum.getTypeEnumByType(function.getType()); + if(Func.isEmpty(typeEnum)) { + throw new ServiceException("函数解析失败!"); + } switch (typeEnum) { // 页面跳转 case JUMP: