diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java index 46e26c4..89a9f98 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java +++ b/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 listByStationId(@RequestParam("stationId") String stationId); + + @GetMapping(LIST) + R> list(StationVideoTypeEntity req); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java index 24fb9db..3d43046 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java +++ b/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 req) { + return R.fail("远程调用失败!"); + } } diff --git a/hzims-service/hzims-big-model/pom.xml b/hzims-service/hzims-big-model/pom.xml index ece5cf6..cedb16a 100644 --- a/hzims-service/hzims-big-model/pom.xml +++ b/hzims-service/hzims-big-model/pom.xml @@ -65,6 +65,16 @@ org.springblade blade-system-api + + + com.hnac.hzims + hzims-operational-api + 4.0.0-SNAPSHOT + + + com.hnac.hzinfo.data + hzinfo-data-sdk + diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java index 13f7a93..afd6df3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java +++ b/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 sessionIds = InteractiveSessionManager.getSessionIds(); + public ReturnT getInteractiveResult(String params) { + List sessionIds = StringUtil.isNotBlank(params) && Func.isNotEmpty(params) ? Func.toStrList(",",params) : InteractiveSessionManager.getSessionIds(); XxlJobLogger.log("开始获取到sessionId:"+ String.join(",", sessionIds)); List 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> videoListR = videoClient.list(new StationVideoTypeEntity()); + if(videoListR.isSuccess()) { + List stationVideoList = videoListR.getData(); + //TODO 同步站点视频指令 + } + return ReturnT.SUCCESS; + } + + @XxlJob(SYNCHRONOUS_SCADA_INSTRUCT) + public ReturnT synchronousScadaInstruct(String params) { + Result> projectListR = projectClient.getProjectByAppId(); + if(projectListR.isSuccess()) { + List projectIds = projectListR.getData().stream().map(ProjectVO::getId).collect(Collectors.toList()); + Result> canvasListR = scadaClient.getCanvasList(projectIds); + if(canvasListR.isSuccess()) { + List canvasList = canvasListR.getData(); + //TODO 同步站点画面指令 + } + } + return ReturnT.SUCCESS; + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java index 708d3e8..de73434 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java +++ b/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"; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java index 1692820..5dc44b2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java +++ b/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 listByStationId(String stationId) { List result = stationVideoTypeService.list(new LambdaQueryWrapper(){{ eq(StationVideoTypeEntity::getStationId,stationId); }}); return result; } + + @Override + @GetMapping(LIST) + public R> list(StationVideoTypeEntity req) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(req); + return R.data(stationVideoTypeService.list(queryWrapper)); + } } diff --git a/pom.xml b/pom.xml index 3339d22..47b1aaa 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,8 @@ com.hnac.hzinfo.data hzinfo-data-sdk - ${bladex.project.version} + + 5.1.1.RELEASE.fix.4 com.xuxueli