Browse Source

fix:选择故障函数添加

zhongwei
haungxing 8 months ago
parent
commit
bdb19c110e
  1. 16
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java
  2. 1
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java
  3. 20
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java
  4. 17
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

16
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java

@ -0,0 +1,16 @@
package com.hnac.hzims.bigmodel.interactive.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/05/16 15:10
*/
@Data
@EqualsAndHashCode
public class FaultSelectionVO extends SelectionVO implements Serializable {
}

1
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java

@ -18,6 +18,7 @@ public enum FuncRouteEnum {
CHOOSE_STATION("choose_station","选择站点"),
CHOOSE_VIDEO("choose_video","选择视频"),
CHOOSE_CANVAS("choose_canvas","选择画面"),
CHOOSE_FAULT("choose_fault","选择故障"),
;
@Getter
private String funcCode;

20
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java

@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants;
import com.hnac.hzims.bigmodel.interactive.vo.ScadaSelectionVO;
import com.hnac.hzims.bigmodel.interactive.vo.StationSelectionVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzims.bigmodel.interactive.vo.VideoSelectionVO;
import com.hnac.hzims.bigmodel.interactive.vo.*;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
@ -60,6 +57,8 @@ public class ExtraResolveStrategyService {
return this.resolveChooseVideo(extra);
case CHOOSE_CANVAS:
return this.resolveChooseScada(extra);
case CHOOSE_FAULT:
return this.resolveChooseFault(extra);
default:
break;
}
@ -68,6 +67,19 @@ public class ExtraResolveStrategyService {
return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class);
}
private ExtraVO resolveChooseFault(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
if(data.containsKey("faults")) {
List<FaultSelectionVO> 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<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));

17
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

@ -90,6 +90,9 @@ public class InteractiveHandler extends TextWebSocketHandler {
case CHOOSE_CANVAS:
this.handleScadaChoose(messageContext,sessionId);
break;
case CHOOSE_FAULT:
this.handleFaultChoose(messageContext,sessionId);
break;
default:
break;
}
@ -168,4 +171,18 @@ public class InteractiveHandler extends TextWebSocketHandler {
wsService.sendMessage(sessionId,textMessage);
}
}
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);
JSONObject data = new JSONObject();
data.put("id",selectionVO.getId());
data.put("name",selectionVO.getName());
Map<String, Object> extra = new HashMap<>(2);
extra.put("func",funcCode);
extra.put("data",data);
interactiveService.specialAsk(sessionId,userId,extra);
}
}

Loading…
Cancel
Save