|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|