Browse Source

#同步实时画面

zhongwei
yang_shj 7 months ago
parent
commit
9ce122e42a
  1. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java
  2. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java
  3. 11
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  4. 46
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
  5. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

2
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 updateVideo;
private String updateCanvas;
} }

2
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<String,Object> request); void updateVideo(Map<String,Object> request);
Boolean updateCanvas(Map<String,Object> request);
List<AnswerVO> getAnswerBySessionIds(String sessionIds); List<AnswerVO> getAnswerBySessionIds(String sessionIds);
Boolean authentication(String stationId, String userId, String funcCode); Boolean authentication(String stationId, String userId, String funcCode);

11
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 @Override
public Boolean updateCanvas(Map<String, Object> 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<AnswerVO> getAnswerBySessionIds(String sessionIds) { public List<AnswerVO> getAnswerBySessionIds(String sessionIds) {
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put("ids",Func.toStrList(",",sessionIds).toArray()); params.put("ids",Func.toStrList(",",sessionIds).toArray());

46
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.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.WebSocketSession;
@ -32,6 +34,7 @@ import org.springframework.web.socket.WebSocketSession;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -108,7 +111,7 @@ public class InteractiveSchedule {
wsService.sendMessage(session,message); wsService.sendMessage(session,message);
} }
// 问题回答完成,去除redis问题标记 // 问题回答完成,去除redis问题标记
if(answerVO.getStatus() == 0){ if(answerVO.getRunning() == 0){
sessionIds.remove(answerVO.getSessionId()); sessionIds.remove(answerVO.getSessionId());
} }
redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY, JSONObject.toJSONString(sessionIds)); redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY, JSONObject.toJSONString(sessionIds));
@ -153,15 +156,42 @@ public class InteractiveSchedule {
@XxlJob(SYNCHRONOUS_SCADA_INSTRUCT) @XxlJob(SYNCHRONOUS_SCADA_INSTRUCT)
public ReturnT synchronousScadaInstruct(String params) { public ReturnT synchronousScadaInstruct(String params) {
Result<List<ProjectVO>> projectListR = projectClient.getProjectByAppId(); // 查询项目数据
if(projectListR.isSuccess()) { Result<List<ProjectVO>> projects = projectClient.getProjectByAppId();
List<String> projectIds = projectListR.getData().stream().map(ProjectVO::getId).collect(Collectors.toList()); if(!projects.isSuccess() || CollectionUtil.isEmpty(projects.getData())){
Result<List<CanvasVO>> canvasListR = scadaClient.getCanvasList(projectIds); return ReturnT.SUCCESS;
if(canvasListR.isSuccess() && CollectionUtil.isNotEmpty(canvasListR.getData())) {
List<CanvasVO> canvasList = canvasListR.getData();
//TODO 同步站点画面指令
} }
// 请求fdp同步实时画面方法参数定义
Map<String,Object> param = new HashMap<>(2);
List<UpdateStationVO> 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<List<CanvasVO>> canvas = scadaClient.getCanvasList(projects.getData().stream().map(ProjectVO::getId).collect(Collectors.toList()));
if(!canvas.isSuccess() || CollectionUtil.isEmpty(canvas.getData())) {
return ReturnT.SUCCESS;
} }
List<UpdateUsualVO> 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; return ReturnT.SUCCESS;
} }
} }

2
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()){ if(station.getWaterLevelMax() < station.getWaterLevel()){
station.setWaterColor(2); station.setWaterColor(2);
}else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.9){ }else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.8){
station.setWaterColor(1); station.setWaterColor(1);
} }
} }

Loading…
Cancel
Save