Browse Source

add:智能诊断页面跳转逻辑

zhongwei
haungxing 9 months ago
parent
commit
4727002415
  1. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java
  2. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java
  3. 10
      hzims-service/hzims-big-model/pom.xml
  4. 48
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
  5. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java
  6. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java
  7. 3
      pom.xml

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java

@ -4,6 +4,7 @@ import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -16,7 +17,11 @@ import java.util.List;
public interface IStationVideoTypeClient {
String API_PREFIX = "/feign/station/videoType";
String LIST_BY_STATION_ID = API_PREFIX + "/listByStationId";
String LIST = API_PREFIX + "/list";
@PostMapping(LIST_BY_STATION_ID)
List<StationVideoTypeEntity> listByStationId(@RequestParam("stationId") String stationId);
@GetMapping(LIST)
R<List<StationVideoTypeEntity>> list(StationVideoTypeEntity req);
}

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java

@ -16,4 +16,9 @@ public class IStationVideoTypeClientFallback implements IStationVideoTypeClient
log.info("调用{}接口失败",LIST_BY_STATION_ID);
return new ArrayList();
}
@Override
public R<List<StationVideoTypeEntity>> list(StationVideoTypeEntity req) {
return R.fail("远程调用失败!");
}
}

10
hzims-service/hzims-big-model/pom.xml

@ -65,6 +65,16 @@
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-operational-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
</dependencies>
<build>

48
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java

@ -6,12 +6,22 @@ import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService;
import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO;
import com.hnac.hzinfo.sdk.v5.scada.ScadaClient;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasVO;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
@ -20,8 +30,10 @@ import org.springframework.web.socket.WebSocketSession;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.GET_INTERACTIVE_RESULT;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.*;
/**
* @Author: huangxing
@ -39,6 +51,12 @@ public class InteractiveSchedule {
private final RedisTemplate redisTemplate;
private final IStationVideoTypeClient videoClient;
private final ProjectClient projectClient;
private final ScadaClient scadaClient;
private final static String HZIMS_BIGMODEL_ASK_KEY = "hzims:bigmodel:ask:key";
// @XxlJob(GET_INTERACTIVE_RESULT)
@ -65,8 +83,8 @@ public class InteractiveSchedule {
// }
@XxlJob(GET_INTERACTIVE_RESULT)
public ReturnT execute(String params) {
List<String> sessionIds = InteractiveSessionManager.getSessionIds();
public ReturnT getInteractiveResult(String params) {
List<String> sessionIds = StringUtil.isNotBlank(params) && Func.isNotEmpty(params) ? Func.toStrList(",",params) : InteractiveSessionManager.getSessionIds();
XxlJobLogger.log("开始获取到sessionId:"+ String.join(",", sessionIds));
List<AnswerVO> answerList = interactiveService.getAnswerBySessionIds(String.join(",", sessionIds));
XxlJobLogger.log("获取到答案:"+JSON.toJSONString(answerList));
@ -93,4 +111,28 @@ public class InteractiveSchedule {
}, getAnswerPoolExecutor));
return ReturnT.SUCCESS;
}
@XxlJob(SYNCHRONOUS_VIDEO_INSTRUCT)
public ReturnT synchronousVideoInstruct(String params) {
R<List<StationVideoTypeEntity>> videoListR = videoClient.list(new StationVideoTypeEntity());
if(videoListR.isSuccess()) {
List<StationVideoTypeEntity> stationVideoList = videoListR.getData();
//TODO 同步站点视频指令
}
return ReturnT.SUCCESS;
}
@XxlJob(SYNCHRONOUS_SCADA_INSTRUCT)
public ReturnT synchronousScadaInstruct(String params) {
Result<List<ProjectVO>> projectListR = projectClient.getProjectByAppId();
if(projectListR.isSuccess()) {
List<String> projectIds = projectListR.getData().stream().map(ProjectVO::getId).collect(Collectors.toList());
Result<List<CanvasVO>> canvasListR = scadaClient.getCanvasList(projectIds);
if(canvasListR.isSuccess()) {
List<CanvasVO> canvasList = canvasListR.getData();
//TODO 同步站点画面指令
}
}
return ReturnT.SUCCESS;
}
}

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java

@ -6,8 +6,14 @@ package com.hnac.hzims.bigmodel.schedule;
*/
public interface XxlJobHandlerConstant {
/**获取问答结果**/
String GET_INTERACTIVE_RESULT = "getInteractiveResult";
/**同步视频指令**/
String SYNCHRONOUS_VIDEO_INSTRUCT = "synchronousVideoInstruct";
String SYNCHRONOUS_SCADA_INSTRUCT = "synchronousScadaInstruct";
String INTERACTIVE_RESULT_KEY = "hzllm:interactive:result";
}

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java

@ -1,10 +1,15 @@
package com.hnac.hzims.operational.station.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.support.utils.Condition;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.service.IStationVideoTypeService;
import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -12,7 +17,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/feign/station/videoType")
@AllArgsConstructor
public class StationVideoTypeClient implements IStationVideoTypeClient {
@ -20,11 +24,18 @@ public class StationVideoTypeClient implements IStationVideoTypeClient {
@ApiLog
@Override
@PostMapping("/listByStationId")
@PostMapping(LIST_BY_STATION_ID)
public List<StationVideoTypeEntity> listByStationId(String stationId) {
List<StationVideoTypeEntity> result = stationVideoTypeService.list(new LambdaQueryWrapper<StationVideoTypeEntity>(){{
eq(StationVideoTypeEntity::getStationId,stationId);
}});
return result;
}
@Override
@GetMapping(LIST)
public R<List<StationVideoTypeEntity>> list(StationVideoTypeEntity req) {
QueryWrapper<StationVideoTypeEntity> queryWrapper = Condition.getQueryWrapper(req);
return R.data(stationVideoTypeService.list(queryWrapper));
}
}

3
pom.xml

@ -76,7 +76,8 @@
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
<version>${bladex.project.version}</version>
<!-- <version>${bladex.project.version}</version>-->
<version>5.1.1.RELEASE.fix.4</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>

Loading…
Cancel
Save