diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java index 2a50a77..d2f0bd9 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java @@ -21,4 +21,6 @@ public class BigModelInvokeUrl { private String updateVideo; + private String updateCanvas; + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index b1d0573..9788cd0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -22,6 +22,8 @@ public interface IInteractiveService { void updateVideo(Map request); + Boolean updateCanvas(Map request); + List getAnswerBySessionIds(String sessionIds); Boolean authentication(String stationId, String userId, String funcCode); 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 1914df5..bb01d93 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 @@ -128,6 +128,17 @@ public class InteractiveServiceImpl implements IInteractiveService { } @Override + public Boolean updateCanvas(Map request) { + HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getUpdateCanvas()) + .body(JSON.toJSONString(request)).execute(); + if (response.getStatus() == HttpServletResponse.SC_OK) { + return true; + } + log.error("远程调用大模型【更新实时画面】接口失败!"); + return false; + } + + @Override public List getAnswerBySessionIds(String sessionIds) { Map params = new HashMap<>(); params.put("ids",Func.toStrList(",",sessionIds).toArray()); 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 d1ed666..9210d2a 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 @@ -24,7 +24,9 @@ import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; @@ -32,6 +34,7 @@ import org.springframework.web.socket.WebSocketSession; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadPoolExecutor; import java.util.stream.Collectors; @@ -108,7 +111,7 @@ public class InteractiveSchedule { wsService.sendMessage(session,message); } // 问题回答完成,去除redis问题标记 - if(answerVO.getStatus() == 0){ + if(answerVO.getRunning() == 0){ sessionIds.remove(answerVO.getSessionId()); } redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY, JSONObject.toJSONString(sessionIds)); @@ -153,15 +156,42 @@ public class InteractiveSchedule { @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() && CollectionUtil.isNotEmpty(canvasListR.getData())) { - List canvasList = canvasListR.getData(); - //TODO 同步站点画面指令 - } + // 查询项目数据 + Result> projects = projectClient.getProjectByAppId(); + if(!projects.isSuccess() || CollectionUtil.isEmpty(projects.getData())){ + return ReturnT.SUCCESS; + } + // 请求fdp同步实时画面方法参数定义 + Map param = new HashMap<>(2); + List stations = projects.getData().stream().map(station -> { + UpdateStationVO updateStation = new UpdateStationVO(); + updateStation.setId(station.getId()); + updateStation.setName(station.getName()); + return updateStation; + }).collect(Collectors.toList()); + param.put("stations", stations); + // 查询画面信息 + Result> canvas = scadaClient.getCanvasList(projects.getData().stream().map(ProjectVO::getId).collect(Collectors.toList())); + if(!canvas.isSuccess() || CollectionUtil.isEmpty(canvas.getData())) { + return ReturnT.SUCCESS; } + List updateUsuals = canvas.getData().stream().map(canva -> { + UpdateUsualVO usualVO = new UpdateUsualVO(); + usualVO.setStationId(canva.getProjectId()); + usualVO.setName(canva.getName()); + // 画面id = + String id = Optional.of(canva.getPicSource()).map(String::valueOf).orElse("") + "^" + + Optional.ofNullable(canva.getContext()).orElse("") + "^" + + Optional.ofNullable(canva.getStationNum()).orElse("") + "^" + + Optional.ofNullable(canva.getProjectId()).orElse("") + "^" + + Optional.ofNullable(canva.getTaskId()).map(String::valueOf).orElse("") + "^" + + Optional.ofNullable(canva.getName()).orElse("") + "^" + + Optional.ofNullable(canva.getId()).map(String::valueOf).orElse("") + "^"; + usualVO.setId(id); + return usualVO; + }).collect(Collectors.toList()); + param.put("canvases", updateUsuals); + Boolean status = interactiveService.updateCanvas(param); return ReturnT.SUCCESS; } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index e6aed35..c7a92e7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -343,7 +343,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService { } if(station.getWaterLevelMax() < station.getWaterLevel()){ station.setWaterColor(2); - }else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.9){ + }else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.8){ station.setWaterColor(1); } }