diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java index 0563a74..9b2ab5f 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java @@ -38,6 +38,6 @@ public class ExtraVO implements Serializable { private boolean isSpecial; @ApiModelProperty("选项") - private List selection; + private List selection; } diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java index 00aa21e..a504076 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java @@ -13,4 +13,6 @@ import java.io.Serializable; @EqualsAndHashCode public class FaultSelectionVO extends SelectionVO implements Serializable { + private Object item; + } diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteSelectionVO.java new file mode 100644 index 0000000..07d95d8 --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteSelectionVO.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/31 09:15 + */ +public class RemoteSelectionVO extends SelectionVO implements Serializable { + + private Object item; + +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java index b32cca2..9b0f7e0 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java @@ -13,4 +13,6 @@ import java.io.Serializable; @EqualsAndHashCode public class ScadaSelectionVO extends SelectionVO implements Serializable { + private Object item; + } 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 99275b9..ef03d20 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 @@ -12,13 +12,14 @@ import java.util.Optional; */ @AllArgsConstructor public enum FuncRouteEnum { - OPEN_CANVAS("open_canvas","打开实时画面",null), - OPEN_VIDEO("open_video","打开视频监控",null), - DIAGNOSE("diagnose","智能诊断",null), - CHOOSE_STATION("choose_station","选择站点",null), - CHOOSE_VIDEO("choose_video","选择视频",null), - CHOOSE_CANVAS("choose_canvas","选择画面",null), - CHOOSE_FAULT("choose_fault","选择故障",null), + OPEN_CANVAS("open_canvas","打开实时画面",FunctionConstants.TypeEnum.JUMP), + OPEN_VIDEO("open_video","打开视频监控",FunctionConstants.TypeEnum.PARAMS), + DIAGNOSE("diagnose","智能诊断",FunctionConstants.TypeEnum.PARAMS), + CHOOSE_STATION("choose_station","选择站点",FunctionConstants.TypeEnum.CHOOSE), + CHOOSE_VIDEO("choose_video","选择视频",FunctionConstants.TypeEnum.CHOOSE), + CHOOSE_CANVAS("choose_canvas","选择画面",FunctionConstants.TypeEnum.CHOOSE), + CHOOSE_FAULT("choose_fault","选择故障",FunctionConstants.TypeEnum.CHOOSE), + CHOOSE_YK("choose_yk","选择遥控",FunctionConstants.TypeEnum.CHOOSE), CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.PARAMS), SHOW_PARAM("show_param","设备参数查询", FunctionConstants.TypeEnum.PARAMS), CHOOSE_YC("choose_yc","选择遥测数据",FunctionConstants.TypeEnum.CHOOSE), 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 8c5999e..26f047e 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 @@ -63,20 +63,17 @@ public class ExtraResolveStrategyService { 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); + case CHOOSE_STATION: case CHOOSE_FAULT: - return this.resolveChooseFault(extra); + case CHOOSE_YC: + case CHOOSE_YK: + return this.resolveChooseSelection(extra,funcRouteEnum); case CONFIRM_YK: return this.resolveConfirmRemote(extra); case SHOW_PARAM: return this.resolveShowParam(extra); - case CHOOSE_YC: - return this.resolveChooseYc(extra); default: break; } @@ -88,19 +85,31 @@ public class ExtraResolveStrategyService { return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); } - private ExtraVO resolveChooseYc(JSONObject extra) { + private ExtraVO resolveChooseSelection(JSONObject extra,FuncRouteEnum funcRouteEnum) { ExtraVO result = new ExtraVO(); - JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); - if(data.containsKey("ycs")) { - List attrs = JSONArray.parseArray(JSON.toJSONString(data.get("ycs")), AttrSelectionVO.class); - result.setSelection(attrs); - } - result.setFuncCode(FuncRouteEnum.CHOOSE_YC.getFuncCode()); + JSONArray selections = JSONArray.parseArray(JSON.toJSONString(extra.get("data"))); + result.setFuncCode(funcRouteEnum.getFuncCode()); result.setSpecial(true); - result.setType(FuncRouteEnum.CHOOSE_YC.getType().getType()); + result.setSelection(selections); + result.setType(funcRouteEnum.getType().getType()); return result; } +// private ExtraVO resolveChooseYc(JSONObject extra) { +// ExtraVO result = new ExtraVO(); +// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); +// if(data.containsKey("yks")) { +// +// +// List attrs = JSONArray.parseArray(JSON.toJSONString(data.get("yks")), AttrSelectionVO.class); +// result.setSelection(attrs); +// } +// result.setFuncCode(FuncRouteEnum.CHOOSE_YC.getFuncCode()); +// result.setSpecial(true); +// result.setType(FuncRouteEnum.CHOOSE_YC.getType().getType()); +// return result; +// } + private ExtraVO resolveShowParam(Map extra) { DataVO data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")),DataVO.class); if(Func.isNotEmpty(data)) { @@ -143,7 +152,7 @@ public class ExtraResolveStrategyService { result.setType(FuncRouteEnum.CONFIRM_YK.getType().getType()); R funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); if(funcVOR.isSuccess()) { - Map param = new HashMap(1); + Map param = new HashMap(); param.put("control",funcVOR.getData()); param.put("deviceName",remoteParam.getDeviceName()); param.put("projectName",remoteParam.getProjectName()); @@ -154,18 +163,18 @@ public class ExtraResolveStrategyService { return result; } - private ExtraVO resolveChooseFault(Map extra) { - ExtraVO result = new ExtraVO(); - JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); - if(data.containsKey("faults")) { - List faults = JSONArray.parseArray(JSON.toJSONString(data.get("faults")), FaultSelectionVO.class); - result.setSelection(faults); - } - result.setFuncCode(FuncRouteEnum.CHOOSE_FAULT.getFuncCode()); - result.setSpecial(true); - result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); - return result; - } +// private ExtraVO resolveChooseFault(Map extra) { +// ExtraVO result = new ExtraVO(); +// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); +// if(data.containsKey("faults")) { +// List faults = JSONArray.parseArray(JSON.toJSONString(data.get("faults")), FaultSelectionVO.class); +// result.setSelection(faults); +// } +// result.setFuncCode(FuncRouteEnum.CHOOSE_FAULT.getFuncCode()); +// result.setSpecial(true); +// result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); +// return result; +// } private ExtraVO resolveDiagnose(Map extra) { ExtraVO result = new ExtraVO(); @@ -187,28 +196,28 @@ public class ExtraResolveStrategyService { * @param extra * @return */ - private ExtraVO resolveChooseStation(Map extra) { - ExtraVO result = new ExtraVO(); - JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); - if(data.containsKey("stations")) { - List stations = JSONArray.parseArray(JSON.toJSONString(data.get("stations")), String.class); - List selectionList = stations.stream().map(stationId -> { - StationSelectionVO selectionVO = new StationSelectionVO(); - R stationR = stationClient.getStationByCode(stationId); - if (stationR.isSuccess() && Func.isNotEmpty(stationR.getData())) { - selectionVO.setId(stationId); - selectionVO.setName(stationR.getData().getName()); - } - return selectionVO; - }).collect(Collectors.toList()); - result.setSelection(selectionList); - result.setFuncCode(FuncRouteEnum.CHOOSE_STATION.getFuncCode()); - result.setSpecial(true); - result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); - } - result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); - return result; - } +// private ExtraVO resolveChooseStation(Map extra) { +// ExtraVO result = new ExtraVO(); +// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); +// if(data.containsKey("stations")) { +// List stations = JSONArray.parseArray(JSON.toJSONString(data.get("stations")), String.class); +// List selectionList = stations.stream().map(stationId -> { +// StationSelectionVO selectionVO = new StationSelectionVO(); +// R stationR = stationClient.getStationByCode(stationId); +// if (stationR.isSuccess() && Func.isNotEmpty(stationR.getData())) { +// selectionVO.setId(stationId); +// selectionVO.setName(stationR.getData().getName()); +// } +// return selectionVO; +// }).collect(Collectors.toList()); +// result.setSelection(selectionList); +// result.setFuncCode(FuncRouteEnum.CHOOSE_STATION.getFuncCode()); +// result.setSpecial(true); +// result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); +// } +// result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); +// return result; +// } private ExtraVO resolveChooseVideo(Map extra) { ExtraVO result = new ExtraVO(); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index e956400..fc6337f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -108,6 +108,7 @@ public class InteractiveHandler extends TextWebSocketHandler { case CHOOSE_STATION: case CHOOSE_YC: case CHOOSE_FAULT: + case CHOOSE_YK: this.handleDefaultChoose(messageContext,sessionId); break; case CHOOSE_VIDEO: @@ -126,10 +127,6 @@ public class InteractiveHandler extends TextWebSocketHandler { IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); String userId = messageContext.getString("userId"); String funcCode = messageContext.getString("funcCode"); - StationSelectionVO selectionVO = messageContext.getObject("selection",StationSelectionVO.class); - JSONObject data = new JSONObject(); - data.put("station_id",selectionVO.getId()); - data.put("station_name",selectionVO.getName()); Map extra = new HashMap<>(2); extra.put("func",funcCode); extra.put("data",messageContext.getObject("selection", JSONObject.class)); @@ -195,26 +192,4 @@ public class InteractiveHandler extends TextWebSocketHandler { } } - private void handleFaultChoose(JSONObject messageContext,String sessionId) { - IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); - String userId = messageContext.getString("userId"); - String funcCode = messageContext.getString("funcCode"); - FaultSelectionVO selectionVO = messageContext.getObject("selection",FaultSelectionVO.class); - Map extra = new HashMap<>(2); - extra.put("func",funcCode); - extra.put("data",selectionVO); - interactiveService.specialAsk(sessionId,userId,extra); - } - - private void handleDataChoose(JSONObject messageContext,String sessionId) { - IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); - String userId = messageContext.getString("userId"); - String funcCode = messageContext.getString("funcCode"); - FaultSelectionVO selectionVO = messageContext.getObject("selection",FaultSelectionVO.class); - Map extra = new HashMap<>(2); - extra.put("func",funcCode); - extra.put("data",selectionVO); - interactiveService.specialAsk(sessionId,userId,extra); - } - } diff --git a/pom.xml b/pom.xml index 7672dcf..fee8f9d 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ com.hnac.hzinfo.data hzinfo-data-sdk - 5.1.1.RELEASE.fix.4 + 5.1.1.RELEASE.fix.5 com.xuxueli